<template>
  <div>
    <MSearchTable :render-data="renderData" />
  </div>
</template>

<script>
import MSearchTable from '@/components/m-search-table/index.vue'
import { menuList } from '@/api/index.js'
export default {
  name: 'MTableDetailList',
  components: { MSearchTable },
  property: {
    type: Array,
    default () {
      return []
    }
  },
  data () {
    return {
      renderData: {
        api: {
          exec: menuList,
          subParams: { orderSn: this.props?.refundSn || '' },
          responseFomate: (res) => {
            console.log(res, 'res')
            const data = {
              total: res.total,
              records: res.data,
              code: 200
            }
            return { data, success: true, code: 200 }
          }
        },
        search: [],
        table: [
          { title: '订单编号', key: 'title' }
        ],
        lineOperation: [
          {
            label: '退款明细',
            hide: (row) => row.row.refundStatus !== 1,
            callback: ({ refresh, row }) => {
              const { refundSn } = row
              // const readOnly = true
              const modal = {
                title: '销售明细',
                width: 1480,
                defaultProps: { refundSn, isPlatform: false, refunded: true },
                btns: false,
                onRefund () {
                  refresh()
                }
              }
              return modal
            }
          },
          {
            label: '申请明细',
            callback: ({ refresh, row }) => {
              console.log(1, '1')
              // const { refundSn } = row
              // const readOnly = true
              const modal = {
                title: '销售明细',
                render: '123',
                width: 500,
                onRefund () {
                  refresh()
                }
              }
              return modal
            }
          }
        ]
      }
    }
  },

  mounted () {},

  methods: {}
}
</script>
<style lang="less" scoped>
:deep(.color-g) {
  color: var(--green-default);
}
:deep(.color-r) {
  color: var(--error-default);
}
</style>
